﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class yonetim_Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "iptal")
        {
            DataList1.EditItemIndex = -1;
            lblhata.Text = "";
            DataList1.DataBind();

        }
    }
    protected override void InitializeCulture()
    {
        try
        {

            HttpCookie cerez = Request.Cookies["LANG"];
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(cerez.Value);
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture(cerez.Value);
            base.InitializeCulture();
        }
        catch { base.InitializeCulture(); }

    }
    protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)
    {
        AccessDataSource1.DeleteParameters.Clear();
        AccessDataSource1.DeleteParameters.Add("id", e.CommandArgument.ToString());
        AccessDataSource1.Delete();
    }
    protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
    {
        DataList1.EditItemIndex = e.Item.ItemIndex;
        DataList1.DataBind();
    }
    protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
    {
        if (IsValid)
        {
            int index = e.Item.ItemIndex;
            string sondeger = ((TextBox)DataList1.Items[index].FindControl("txtkat")).Text;

            
            string sondeger2 = ((FredCK.FCKeditorV2.FCKeditor)DataList1.Items[index].FindControl("fck")).Value;
            AccessDataSource1.UpdateParameters.Clear();
            AccessDataSource1.UpdateParameters.Add("hbaslik", sondeger);
            AccessDataSource1.UpdateParameters.Add("hkonu",sondeger2.ToString());
            AccessDataSource1.UpdateParameters.Add("hid", e.CommandArgument.ToString());
            AccessDataSource1.Update();
            lblhata.Text = "";
            DataList1.EditItemIndex = -1;
            DataList1.DataBind();
        }
    }
    protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
    {

    }
}
